/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.osbosoftware.vista.utils;

import java.io.IOException;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;

/**
 *
 * @author elJefe
 */
public class BasePaginas {

    private FacesContext context;

    public void Basepaginas() {
        
    }

    public String getPath() {
        setContext(FacesContext.getCurrentInstance());
        return getContext().getExternalContext().getRequestContextPath();
    }

    public String getRealPath(String busca) {
        setContext(FacesContext.getCurrentInstance());
        ServletContext servletContext = (ServletContext) getContext().getExternalContext().getContext();
        String path = servletContext.getRealPath(busca);
        return path;
    }

    /**
     * @return the context
     */
    public FacesContext getContext() {
        return context;
    }

    /**
     * @param context the context to set
     */
    public void setContext(FacesContext context) {
        this.context = context;
    }
    public String Redireccionar(String direccion) throws IOException{
        // codigos previos para pasar de paginas
        Utilidades u=new Utilidades();
        u.redireccion(this.getPath()+direccion);
        return null;
    }

}
